﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AdminCmsArticleControl.ascx.cs"
    Inherits="BIS.Portal.Modules.CMS.Adm.AdminCmsArticleControl" %>
<style type="text/css">
    #content
    {
        margin: 0;
        width: 955px;
        text-align: center;
        background: #f5f8f8;
    }
    .childen
    {
        text-align: center;
        width: 955px;
        background: #e7efef;
        clear: both;
        display: table;
    }
    .childen1
    {
        text-align: left;
        width: 955px;
        clear: both;
    }
    .leftSearch
    {
        width: 400px;
        text-align: left;
        float: left;
    }
    .rightSearch
    {
        width: 530px;
        text-align: left;
        float: left;
    }
    .rightSearch1
    {
        float: right;
        text-align: right;
        width: auto;
    }
    .childenSearch
    {
        width: 415px;
        height: 30px;
        float: left;
        clear: both;
    }
    .childenSearch1
    {
        width: 520px;
        height: 30px;
        float: left;
        clear: both;
    }    
    .left
    {
        float: left;
        width: 125px;
        height: 30px;
    }
    .right
    {
        float: left;
        width: 280px;
        height: 30px;
    }
</style>

<script src='<%# ModulePath + "JS/jquery-ui/jquery.ui.datepicker.js" %>' type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready(function() {
        $("#<%=grvArticle.ClientID %> #chkAll").click(function() {
            var $this = $(this);
            if ($this.attr("checked") == true) {
                $(".chkSell :checkbox").attr("checked", "checked");
            }
            else {
                $(".chkSell :checkbox").removeAttr("checked");
            }
        });

        $("#<%=txtSearchToDate.ClientID %>").datepicker();
        $("#<%=txtSearchFromDate.ClientID %>").datepicker();
    });
	
</script>

<div id="content">
    <div style="background: #CCCCCC; width: 955px; text-align: left; height: 30px; display: table;">
        <div style="width: 450px; text-align: left; float: left">
            <h2 style="color: #7092be">
                Quản lý danh sách tin</h2>
        </div>
        <div style="width: 495px; text-align: right; float: left; height: 19px;">
            <asp:HyperLink ID="hblAddNewArticle" runat="server" ForeColor="Blue" Text="Thêm tin mới"></asp:HyperLink>
        </div>
    </div>
    <div style="width: 955px; height: 8px; float: left; clear: both">
        &nbsp;
    </div>
    <div>
        <div class="childen">
            <div style="width: 955px; height: 10px; float: left; clear: both">
                &nbsp;</div>
            <div class="leftSearch">
                <div class="childenSearch">
                    <div class="left">
                        Từ khóa tìm kiếm:</div>
                    <div class="right">
                        <asp:TextBox ID="txtSearch" runat="server" Width="178px"></asp:TextBox>
                    </div>
                    <div class="childenSearch">
                        <div class="left">
                            Tin:&nbsp;</div>
                        <div class="right">
                            <asp:DropDownList ID="ddlIsHotArticle" runat="server" Height="20px" 
                                Width="178px">
                                <asp:ListItem Text="--- Toàn bộ ---" Value="-1" />
                                <asp:ListItem Text="Thông thường" Value="0" />
                                <asp:ListItem Text="Tin nổi bật" Value="1" />
                            </asp:DropDownList>
                        </div>
                    </div>
                    <div class="childenSearch">
                        <div class="left">
                            Ngày đăng từ:</div>
                        <div class="right">
                            <asp:TextBox ID="txtSearchFromDate" runat="server" Width="178px"></asp:TextBox>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                ControlToValidate="txtSearchFromDate" ErrorMessage="sai định dạng" 
                                ValidationExpression="^((((0[13578])|(1[02]))[\/]?(([0-2][0-9])|(3[01])))|(((0[469])|(11))[\/]?(([0-2][0-9])|(30)))|(02[\/]?[0-2][0-9]))[\/]?\d{4}$"></asp:RegularExpressionValidator>
                        </div>
                    </div>
                </div>
            </div>
            <div class="rightSearch">
                <div class="childenSearch1">
                    <div class="left">
                        Nhóm nội dung:</div>
                    <div class="right">
                        <asp:DropDownList ID="ddlCategoryName" runat="server" Height="27px" Width="178px">
                        </asp:DropDownList>
                    </div>
                </div>
                <div class="childenSearch1">
                    <div class="left">
                        Trạng thái:</div>
                    <div class="right">
                        <asp:DropDownList ID="ddlStatus" runat="server" Height="27px" Width="178px">
                            <asp:ListItem Text="---Xem toàn bộ---" Value="-1" />
                            <asp:ListItem Text="Tạm ẩn" Value="0" />
                            <asp:ListItem Text="Hiển thị" Value="1" />
                            <asp:ListItem Text="Xóa logic" Value="99" />
                        </asp:DropDownList>
                    </div>
                </div>
                <div class="childenSearch1">
                    <div class="left">
                        Ngày đăng đến:</div>
                    <div class="right">
                        <asp:TextBox ID="txtSearchToDate" runat="server" Height="23px" Width="178px"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                            ControlToValidate="txtSearchToDate" ErrorMessage="Sai định dạng" 
                            ValidationExpression="^((((0[13578])|(1[02]))[\/]?(([0-2][0-9])|(3[01])))|(((0[469])|(11))[\/]?(([0-2][0-9])|(30)))|(02[\/]?[0-2][0-9]))[\/]?\d{4}$"></asp:RegularExpressionValidator>
                    </div>
                </div>
                <div class="childenSearch1">
                    <asp:Button ID="btnSearch" runat="server" Text="Tìm Kiếm" Width="105px" OnClick="btnSearch_Click" />
                </div>
            </div>
        </div>
        <div style="width: 955px; height: 30px; clear: both">
            <div class="leftSearch">
                <asp:Button ID="btnDelete" runat="server" Text="Xóa các tin đang chọn" OnClick="btnDelete_Click" /></div>
            <div class="rightSearch1">
                <asp:Button ID="btnUpdateNews" runat="server" Text="Cập nhật tin đang hiển thị" OnClick="btnUpdateNews_Click" /></div>
        </div>
        <div class="childen1">
            <asp:GridView ID="grvArticle" CssClass="chkSell" runat="server" AutoGenerateColumns="False"
                AllowPaging="True" Style="margin-right: 200px" PagerSettings-PageButtonCount="10"
                PageSize="5" AllowSorting="True" OnPageIndexChanging="grvArticle_PageIndexChanging"
                CellPadding="0" CellSpacing="0" Width="955px" OnRowDataBound="grvArticle_RowDataBound"
                HeaderStyle-BackColor="#efefef" HeaderStyle-Height="40px">
                <Columns>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            <input id="chkAll" type="checkbox" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="chkSell" runat="server" />
                        </ItemTemplate>
                        <HeaderStyle Width="1px" HorizontalAlign="Center"></HeaderStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Mô tả">
                        <ItemTemplate>
                            <div style="width: 250px">
                                <asp:Label ID="lblLanguage" runat="server" Font-Bold="true" Text='<%#Eval("Article_title")%>'></asp:Label>
                                <asp:Label ID="lblPostDate" runat="server" ForeColor="#CCCCCC" Text='<%#Eval("Post_date")%>'></asp:Label>
                            </div>
                            <div style="width: 250px">
                            <div style="float:left">
                                <asp:Image ID="Image1" runat="server" Width="80px" Height="80" ImageUrl='<%#Eval("Thumb_image")%>' /></div>
                               <asp:Literal ID="ltrDescription" runat="server" Text='<%#Eval("Article_description")%>'></asp:Literal>
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>                    
                    <asp:BoundField HeaderText="Nhóm nội dung" DataField="Category_name" />               
                    <asp:BoundField HeaderText="Ngày cập nhật cuối" DataField="Last_date" ItemStyle-Font-Bold="true" />
                    <asp:BoundField HeaderText="Người cập nhật cuối cùng" DataField="Last_update_by"
                        ItemStyle-Font-Bold="true" />
                    <asp:TemplateField HeaderText="Thứ tự hiển thị">
                        <ItemTemplate>
                            <div style="text-align: center">
                                <asp:TextBox ID="txtArticlePriority" Width="30px" runat="server" Enabled="false"
                                    Text='<%#Eval("Article_priority") %>'></asp:TextBox>
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Tin nổi bật">
                        <ItemTemplate>
                            <div style="text-align: center">
                                <asp:CheckBox ID="chkIsHotArticle" runat="server" />
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Trạng thái">
                        <ItemTemplate>
                            <asp:DropDownList ID="ddlGridStatus" runat="server">
                                <asp:ListItem Text="Tạm ẩn" Value="0" />
                                <asp:ListItem Text="Hiển thị" Value="1" />
                                <asp:ListItem Text="Xóa logic" Value="99" />
                            </asp:DropDownList>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:HyperLink ID="llkCopy" runat="server">
                                <asp:Image ID="ImageCopy" runat="server" Width="20px" Height="20px" ImageUrl='<%# ModulePath + "Images/copy.png" %>' />
                            </asp:HyperLink>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:HyperLink ID="llkEdit" runat="server">
                                <asp:Image ID="ImageEdit" ImageUrl='<%# ModulePath + "Images/edit.png" %>' Width="20px"
                                    Height="20px" runat="server" />
                            </asp:HyperLink>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                </Columns>
                <EmptyDataTemplate>
                    No results!
                </EmptyDataTemplate>
            </asp:GridView>
        </div>
    </div>
    <!-- /content -->
</div>
